package com.mapper;

import com.entity.Storage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  仓库Mapper 接口
 * </p>
 *
 * @author aiou
 * @since 2025-06-09
 */
@Mapper
public interface StorageMapper{

    //根据仓库编码查询仓库
    Storage selectAllByCode(String storageCode);

    //查询所有仓库
    List<Storage> selectAll();

    //仓库管理-删除
    @Delete("delete from storage where storage_id = #{id}")
    boolean deleteById(Integer id);

    //仓库管理-保存
    @Insert("insert into storage(storage_code,storage_name,position,phone,chairman) " +
            "values(#{storageCode},#{storageName},#{position},#{phone},#{chairman})")
    boolean save(Storage storage);
    //仓库管理-修改
    @Update("update storage set storage_code = #{storageCode},storage_name = #{storageName},position = #{position},phone = #{phone},chairman=#{chairman} " +
             "where storage_id = #{storageId}")
    boolean updateById(Storage storage);
}
